package com.cd.sendRequest.jpa.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

@Data
@Entity
@Table(name = "db_home_banner",
        indexes = {
                @Index(name = "idx_type_order", columnList = "img_order,type") // 添加索引优化查询性能
        })
@NoArgsConstructor
@AllArgsConstructor
public class HomeBanner {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    //序号
    @Column(name = "img_order",length = 8, columnDefinition = "INT(8)")
    private Integer order;

    //type 首页大图 二次元轮播图 三次元轮播图
    @Column(name = "type",length = 20, columnDefinition = "VARCHAR(20)")
    private String type;

    //图片路径
    @Column(name = "img_path",length = 200, columnDefinition = "VARCHAR(200)")
    private String imgPath;

    //描述
    @Column(name = "description",length = 200, columnDefinition = "VARCHAR(200)")
    private String description;
}
